package com.boot.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class MyConsumer {
    // 监听多个topic
    @KafkaListener(topics = {"example"} )  //   "test","mytopic","hmy_biz_test"
    public void listen(ConsumerRecord<?,String> record) {
        String value = record.value();
        System.out.println( record.topic() + ",收到消息:\n" + value);
        System.out.println(record);
    }
}
